package com.netjava.service.impl;

import java.util.List;

import com.netjava.dao.IEndAuctionDAO;
import com.netjava.pojo.EndAuction;
import com.netjava.pojo.User;
import com.netjava.service.IEndAuctionService;

/**
 * 拍卖结束业务的实施类。
 * @author nana
 *
 */
public class EndAuctionService  implements IEndAuctionService {

	private IEndAuctionDAO endAuctionDao;
	public void delete(EndAuction endAuction) {
		endAuctionDao.delete(endAuction);
	}

	public EndAuction getEndAuctionById(Integer id) {
		return endAuctionDao.findById(id);
	}

	public void addEndAuction(EndAuction endAuction) {
		endAuctionDao.save(endAuction);
	}

	public IEndAuctionDAO getEndAuctionDao() {
		return endAuctionDao;
	}

	public void setEndAuctionDao(IEndAuctionDAO endAuctionDao) {
		this.endAuctionDao = endAuctionDao;
	}

	@SuppressWarnings("unchecked")
	public List<EndAuction> getAllEndauc() {
		List<EndAuction> list=endAuctionDao.findAll();
		return list;
	}
	
	public List<EndAuction> findByUserId(User user){
		List<EndAuction> list=endAuctionDao.findByUserId(user);
		return list;
	}

	public List<EndAuction> getAllEndaucByTime() {
		List<EndAuction> list=endAuctionDao.findAllByTime();
		return list;
	}

}
